package cn.sciento.transfer.api.controller.v1;

import cn.sciento.swagger.annotation.Permission;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import cn.sciento.core.base.BaseController;
import cn.sciento.core.util.Results;
import cn.sciento.transfer.app.service.DistributionIdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("distributionIdController.v1")
@RequestMapping({"/v1/distribution-ids"})
public class DistributionIdController extends BaseController {
  @Autowired
  private DistributionIdService distributionIdService;
  
  @ApiOperation("获取分布式ID")
  @Permission(permissionLogin = true)
  @GetMapping({"/{bizType}"})
  public ResponseEntity<Long> getDistributionId(@ApiParam("业务类型") @PathVariable String bizType) {
    return Results.success(this.distributionIdService.getDistributionId(bizType));
  }
}
